﻿using Mangox.Model.MangoxDB;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MGXAPI.Models
{
    /// <summary>
    /// 基础返回
    /// </summary>
    public class ResultModel
    {
        /// <summary>
        /// -1异常 0正常
        /// </summary>
        public virtual int Code { get; set; }

        /// <summary>
        /// 消息提示
        /// </summary>
        public string Msg { get; set; }

        /// <summary>
        /// 每次操作接口，Token值会更新，前端保存回传，用于授权和时间过期
        /// 保存后，每次回传最新Token
        /// </summary>
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public string TokenUpdate { get; set; }

        /// <summary>
        /// 返回实体
        /// object可以序列化出来？可以反射赋值
        /// </summary>
        public object Data { get; set; }
        //public dynamic Data { get; set; }

    }

    /// <summary>
    /// 账号密码登陆返回
    /// </summary>
    public class LoginResultModel : ResultModel
    {
        /// <summary>
        /// 废弃，使用Token
        /// </summary>
        //public string SessionID { get; set; }

        /// <summary>
        /// 登陆后获得的Token值，前端保存，调用需要授权的接口回传验证
        /// Token userid+时间 算法加密Token，并且具有有一定的时效性
        /// </summary>
        public string Token { get; set; }
    }

    /// <summary>
    /// 小程序登陆返回
    /// </summary>
    public class LoginResultModel_Wechar : LoginResultModel
    {
        public string openid { get; set; }
        public string userHash { get; set; }
        public double amount { get; set; }

        /// <summary>
        /// 赠送币消息，空为没赠送
        /// </summary>
        public string GiveMsg { get; set; }
    }

    /// <summary>
    /// 水龙头初始化返回
    /// </summary>
    public class SLTResultModel
    {
        /// <summary>
        /// 用户量
        /// </summary>
        public long UserCount { get; set; }

        /// <summary>
        /// 点击量
        /// </summary>
        public long TouchCount { get; set; }
    }

}